package site.marqstree.latte.ec.main.sort.content;

import com.chad.library.adapter.base.BaseNodeAdapter;
import com.chad.library.adapter.base.entity.node.BaseNode;

import java.util.List;

/*
 * 项目名: EleCommerce
 * 包名: site.marqstree.latte.ec.main.sort.content
 * 文件名: NodeSectionAdapter
 * 创建者: marqstree
 * 创建时间: 2020/1/30 9:44
 * 描述: TODO
 */
public class NodeSectionAdapter extends BaseNodeAdapter {

    public NodeSectionAdapter() {
        super();
        addFullSpanNodeProvider(new RootNodeProvider());
        addNodeProvider(new ItemNodeProvider());
    }

    @Override
    protected int getItemType(List<? extends BaseNode> list, int position) {
        BaseNode node = list.get(position);
        if (node instanceof RootNode) {
            return 0;
        } else if (node instanceof ItemNode) {
            return 1;
        }
        return -1;
    }
}
